package com.yimi.yinhepda.views.createPackage_module;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import butterknife.Bind;
import com.yimi.yinhepda.R;
import com.yimi.yinhepda.db.dao.BuildPckScanTableDao;
import com.yimi.yinhepda.base.BaseInitActivity;

/**
 * 建包管理页面
 *
 * @author tianjin
 */
public class CreatePackageMangerActivity extends BaseInitActivity {

  /** 标题栏左边 */
  @Bind(R.id.title) TextView mTvTitle;
  /** 标题栏中间 */
  @Bind(R.id.num) TextView mTvNum;
  /** 返回按钮 */
  @Bind(R.id.create_package_back_btn) Button mBtnCreatePck;
  /** 建包操作按钮 */
  @Bind(R.id.create_package_btn) Button mBtnReleasePck;
  /** 解包操作按钮 */
  @Bind(R.id.release_package_btn) Button mBtnBack;
  /** 任务暂存集 */
  @Bind(R.id.ceate_package_task_temp_save_list) Button mBtnTempSaveList;

  @Override public int getContentViewId() {
    return R.layout.activity_create_package_management;
  }

  @Override public void initView(Bundle savedInstanceState) {
    mTvTitle.setText("建包管理");
  }

  @Override public void initEvent() {
    mBtnBack.setOnClickListener(this);
    mBtnCreatePck.setOnClickListener(this);
    mBtnReleasePck.setOnClickListener(this);
    mBtnTempSaveList.setOnClickListener(this);
  }

  @Override public void initData() {
  }

  @Override public String getPageName() {
    return getString(R.string.page_create_package);
  }

  @Override protected void onResume() {
    super.onResume();
    /** 查询未上传数据*/
    int totalNotUploadNum = new BuildPckScanTableDao().queryNotUploadDataNum();
    mTvNum.setText(totalNotUploadNum + "");
  }

  @Override public void onClick(View v) {
    super.onClick(v);
    switch (v.getId()) {
      case R.id.create_package_btn:
        //建包操作
        toActivity(CreatePackageOperatorActivity.class);
        break;
      case R.id.release_package_btn:
        //解包出货
        toActivity(ReleasePackageOperatorActivity.class);
        break;
      case R.id.ceate_package_task_temp_save_list:
        //任务暂存集
        toActivity(CreatePackageTaskTempSaveList.class);
        break;
      case R.id.create_package_back_btn:
        //返回
        finish();
        break;
      default:
        break;
    }
  }

  @Override protected void onDestroy() {
    super.onDestroy();
  }
}
